package com.ruoyi.law.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageCondition;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.law.domain.entity.LawVip;
import com.ruoyi.law.service.ILawVipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author code
 * @since 2022-11-24
 */
@Api(tags = "vip类型")
@RestController
@RequestMapping("/vip")
public class LawVipController extends BaseController {

    @Autowired
    private ILawVipService vipService;

    @Anonymous
    @ApiOperation("列表")
    @GetMapping("/list")
    public R<Page<LawVip>> list(PageCondition<LawVip> pageCondition) {
        Page<LawVip> page = vipService.page(pageCondition.toPage());
        return R.ok(page);
    }

    @Anonymous
    @ApiOperation("详情")
    @GetMapping("/info")
    public R<LawVip> info(Long id) {
        LawVip vip = vipService.getById(id);
        return R.ok(vip);
    }

    @ApiOperation("修改")
    @PostMapping("/update")
    public R<Object> update(@RequestBody LawVip lawVip) {
        vipService.updateById(lawVip);
        return R.ok();
    }

    @ApiOperation("新增")
    @PostMapping("/save")
    public R<Object> save(@RequestBody LawVip lawVip) {
        vipService.save(lawVip);
        return R.ok();
    }

}
